package com.itheima;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class Demo03 {

    public static void main(String[] args) {

        Collection<String> c = new ArrayList<>();

        c.add("cai");
        c.add("xu");
        c.add("kun");
        c.add("love");
        c.add("ctrl");

        //
        Iterator<String> iterator = c.iterator();

        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }

        System.out.println("--------------------------------");

        //增强for循环
        for (String a : c){
            System.out.println(a);
        }

        System.out.println("-------------------------------------");

        int[] arr = {12,34,6,5,23};

        for (int a : arr){
            System.out.println(a);
        }
    }
}
